package com.ssy.lingxi.order.api.model.vo.response;

import com.ssy.lingxi.common.constant.order.OrderTypeEnum;
import com.ssy.lingxi.common.utils.DateUtil;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;

/**
 * 售后能力 - 根据订单合同分页查询订单列表返回
 * @author 万宁
 * @version 2.0.0
 * @date 2021-08-25
 */
public class OrderAfterSaleOrderContractFeignVO implements Serializable {
    private static final long serialVersionUID = 6932497483660298091L;

    public OrderAfterSaleOrderContractFeignVO() {
    }

    public OrderAfterSaleOrderContractFeignVO(Long orderId, String orderNo, String digest, Integer orderType, LocalDateTime createTime, BigDecimal refPrice, BigDecimal quantity, Boolean tax, BigDecimal taxRate, Integer outerStatus) {
        this.orderId = orderId;
        this.orderNo = orderNo;
        this.digest = digest;
        this.orderType = orderType;
        this.orderTypeName = OrderTypeEnum.getNameByCode(orderType);
        this.createTime = DateUtil.convertToTimeMillis(createTime);
        this.totalAmount = refPrice.multiply(quantity).setScale(2, RoundingMode.HALF_UP);
        this.tax = tax;
        this.taxRate = taxRate;
        this.outerStatus = outerStatus;
        this.outerStatusName = "";
    }

    /**
     * 订单Id
     */
    private Long orderId;

    /**
     * 订单编号
     */
    private String orderNo;

    /**
     * 订单摘要
     */
    private String digest;

    /**
     * 订单类型枚举，定义在 OrderTypeEnum 中
     */
    private Integer orderType;

    /**
     * 订单类型名称
     */
    private String orderTypeName;

    /**
     * 下单时间
     */
    private Long createTime;

    /**
     * 订单金额
     */
    private BigDecimal totalAmount;

    /**
     * 是否含税，true-含税，false-不含税
     */
    private Boolean tax;

    /**
     * 税率
     */
    private BigDecimal taxRate;

    /**
     * 订单外部状态枚举
     */
    private Integer outerStatus;

    /**
     * 订单外部状态名称
     */
    private String outerStatusName;

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getDigest() {
        return digest;
    }

    public void setDigest(String digest) {
        this.digest = digest;
    }

    public Integer getOrderType() {
        return orderType;
    }

    public void setOrderType(Integer orderType) {
        this.orderType = orderType;
    }

    public String getOrderTypeName() {
        return orderTypeName;
    }

    public void setOrderTypeName(String orderTypeName) {
        this.orderTypeName = orderTypeName;
    }

    public Long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }

    public BigDecimal getTotalAmount() {
        return totalAmount;
    }

    public void setTotalAmount(BigDecimal totalAmount) {
        this.totalAmount = totalAmount;
    }

    public Boolean getTax() {
        return tax;
    }

    public void setTax(Boolean tax) {
        this.tax = tax;
    }

    public BigDecimal getTaxRate() {
        return taxRate;
    }

    public void setTaxRate(BigDecimal taxRate) {
        this.taxRate = taxRate;
    }

    public Integer getOuterStatus() {
        return outerStatus;
    }

    public void setOuterStatus(Integer outerStatus) {
        this.outerStatus = outerStatus;
    }

    public String getOuterStatusName() {
        return outerStatusName;
    }

    public void setOuterStatusName(String outerStatusName) {
        this.outerStatusName = outerStatusName;
    }
}
